<script setup lang="ts">
import { ref } from 'vue'
const foods=ref(['猪脚饭','黄焖鸡','把子肉','白切鸡'])
const buyfood=(food :string )=>{
alert('你购买了'+food)
}

const  Addfood=()=>{
  foods.value.push('ikun专属')
}


</script>
<template>
<div v-for="(item,index) in foods" :key="index">
<span>
   {{ index+1 }}---{{ item }}----
   <button @click="buyfood(item)">购买</button>
   
</span>
</div>
<button @click="Addfood">点击添加</button>
</template>

<style>

</style>
